<?php
import( 'de.ceus-media.framework.krypton.core.DefinitionAction' );
/**
 *	Password Action.
 *	@package		mv2.action.authentification
 *	@extends		CMF_Krypton_Core_DefinitionAction
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			23.04.2007
 *	@version		0.1
 */
/**
 *	Password Action.
 *	@package		mv2.action.authentification
 *	@extends		CMF_Krypton_Core_DefinitionAction
 *	@author			Christian Würker <Christian.Wuerker@CeuS-Media.de>
 *	@since			23.04.2007
 *	@version		0.1
 */
class Action_Authentication_Password extends CMF_Krypton_Core_DefinitionAction
{
	/**
	 *	Constructor.
	 *	@access		public
	 *	@return		void
	 */
	public function __construct()
	{
		parent::__construct();
		$this->loadLanguage( 'auth' );
		$this->addAction( 'sendPassword' );
	}
		
	/**
	 *	Creates a new Password and sends it to User via eMail.
	 *	@access		protected
	 *	@return		void
	 */
	protected function sendPassword()
	{
		$request	= $this->registry->get( 'request' );
		$auth		= $this->registry->get( 'auth' );
		
		if( $auth->isAuthenticated() )
			return;
		try
		{
			$result	= $auth->sendPassword( $request->getAll(), "for_" );
			$this->messenger->noteSuccess( $this->words['auth']['msg']['success_password_sent'] );
			$this->restart( "?link=login" );
		}
		catch( Exception $e )
		{
			$this->handleException( $e, 'auth', 'sendPassword' ); 
		}
		
//		$this->showResultMessages( $result, $auth, 'auth', 'sendPassword', 'success_password_sent' );
	}
}
?>